﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.Text;

using Kenly.DBFramework.Reflection;
using Kenly.DBFramework;

namespace Kenly.DBFramework
{
    /// <summary>
    /// Factoryy to create CommandExecutor.
    /// </summary>
    public static class CommandExecutorFactory
    {

        #region Operations

        /// <summary>
        /// Creates TableCommandExecutor.
        /// </summary>
        /// <returns></returns>
        public static ITableCommandExecutor CreateTableCommandExecutor(DatabaseType dbType, string connectionString)
        {
            IDatabase database = DatabaseFactory.CreateInstance(dbType);
            database.ConnectionString = connectionString;
            return database.CreateTableCommandExecutor();
        }

        /// <summary>
        /// Creates ViewCommandExecutor.
        /// </summary>
        /// <returns></returns>
        public static IViewCommandExecutor CreateViewCommandExecutor(DatabaseType dbType, string connectionString)
        {
            IDatabase database = DatabaseFactory.CreateInstance(dbType);
            database.ConnectionString = connectionString;
            return database.CreateViewCommandExecutor();
        }

        #endregion  //Operations

    }


}